package com.item.mall.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.item.mall.entity.Product;
import com.item.mall.mapper.ProductMapper;
import com.item.mall.service.ProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 张津瑞、彭家博
 * @since 2021-07-31
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {

    @Autowired
    ProductMapper productMapper;

    @Override
    public List<Product> findProduct(String type, Integer id) {
        QueryWrapper queryWrapper =new QueryWrapper();
        queryWrapper.eq("categorylevel"+type+"_id",id);
        List<Product> list = productMapper.selectList(queryWrapper);
        return list;
    }
}
